{% if template == 'index' %}
    <link rel="canonical" href="https://{{ current_domain }}"/>
{% elsif template == 'collection_list' %}
    <link rel="canonical" href="https://{{ current_domain }}/collections{% if paginate and  paginate.current_page != '1' %}?page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'collection_detail' %}
    <link rel="canonical" href="https://{{ current_domain }}/collections/{{ collection.handle }}{% if paginate and  paginate.current_page != '1' %}?page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'blog_list' %}
    <link rel="canonical" href="https://{{ current_domain }}/blogs{% if paginate and paginate.current_page != '1' %}?page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'blog_detail' %}
    <link rel="canonical" href="https://{{ current_domain }}/blogs/{{ blog.handle }}"/>
{% elsif template == 'topic_list' %}
    <link rel="canonical" href="https://{{ current_domain }}/topics{% if paginate and paginate.current_page != '1' %}?page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'topic_detail' %}
        <link rel="canonical" href="https://{{ current_domain }}/topics/{{ topic.handle }}"/>
{% elsif template == 'blog_collection' %}
    <link rel="canonical" href="https://{{ current_domain }}/news{% if paginate and paginate.current_page != '1' %}?page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'blog_collection_detail' %}
    <link rel="canonical" href="https://{{ current_domain }}/news/{{ news_detail.handle }}{% if posts.paginate and posts.paginate.current_page != '1' %}?page={{ posts.paginate.current_page }}{% endif %}"/>
{% elsif template == 'product_detail' %}
    <link rel="canonical" href="https://{{ current_domain }}/products/{{ product.handle }}"/>
{% elsif template == 'page_detail' %}
    <link rel="canonical" href="https://{{ current_domain }}/pages/{{ page.handle }}"/>
{% elsif template == 'customer_login' %}
    <link rel="canonical" href="https://{{ current_domain }}/account/login"/>
{% elsif template == 'customer_resetpassword' %}
    <link rel="canonical" href="https://{{ current_domain }}/account/resetpassword"/>
{% elsif template == 'customer_trackingorder' %}
    <link rel="canonical" href="https://{{ current_domain }}/account/trackingorder"/>
{% elsif template == 'comments_list' %}
    <link rel="canonical" href="https://{{ current_domain }}/comments{% if paginate and paginate.current_page != '1' %}?page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'comments_detail' %}
    <link rel="canonical" href="https://{{ current_domain }}/comments/{{product_comment.product.handle}}{% if paginate and paginate.current_page != '1' %}?page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'search_detail' %}
    <link rel="canonical" href="https://{{ current_domain }}/search?q={{search.keywords}}{% if paginate and paginate.current_page != '1' %}&page={{ paginate.current_page }}{% endif %}"/>
{% elsif template == 'module_notfound' %}
    <link rel="canonical" href="https://{{ current_domain }}/404"/>
{% endif %}
